package kr.co.probrain.manager;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;

import kr.co.probrain.util.DBManager;

public class ManagerDAO {
	private Connection conn;
	private PreparedStatement pstmt;
	private ResultSet rs;

	public int setItem(InOutcomeVO vo) {
		DBManager db = new DBManager();
		int check = 0;

		String sql = "INSERT INTO T_INOUTCOME VALUES (SEQ_MNO.NEXTVAL, ?, ?, ?, ?, ?, ?)";

		try {
			conn = db.getConn();
			pstmt = conn.prepareStatement(sql);
//			rs = pstmt.executeQuery();

			pstmt.setString(1, vo.getDays());
			pstmt.setInt(2, vo.getIncome());
			pstmt.setInt(3, vo.getOutcome());
			pstmt.setString(4, vo.getNote());
			pstmt.setString(5, vo.getLocation());
			pstmt.setString(6, vo.getReceipt());

			check = pstmt.executeUpdate();

		} catch (SQLException e) {
			e.printStackTrace();
		} finally {
			try {
				if (conn != null)
					conn.close();
				if (pstmt != null)
					pstmt.close();
				if (rs != null)
					rs.close();
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		return check;

	}
}
